#include<bits/stdc++.h>
#define lowbit(x) ((x)&-(x))
using namespace std;
int n,L;
int ans;
int a[200011],b[200011];
int fa[1 << 20],fb[1 << 20],dui[1 << 20];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("lock.in","r",stdin);
	freopen("lock.out","w",stdout);
	cin >> n >> L;
	for(int i = 0;i < n;i++) cin >> a[i] >> b[i];
	for(int i = 0;i < n;i++) dui[1 << i] = i;
	for(int S = 1;S < (1 << n);S++)
	{
		int T = S ^ lowbit(S);
		fa[S] = fa[T] ^ a[dui[lowbit(S)]],fb[S] = fb[T] ^ b[dui[lowbit(S)]];
		if(fa[S] <= L) ans = max(ans,fb[S]);
	}
	cout << ans;
	return 0;
}
